package com.heima.article.feign;

import com.heima.apis.article.IArticleClient;
import com.heima.article.mapper.ApArticleContentMapper;
import com.heima.article.service.ApArticleContentService;
import com.heima.article.service.ApArticleService;
import com.heima.model.article.dtos.ApArticleDto;
import com.heima.model.common.dtos.ResponseResult;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequiredArgsConstructor
public class ArticleClient implements IArticleClient {

    //文章服务
    private final ApArticleService apArticleService;

    //文章详情内容服务
    private final ApArticleContentService apArticleContentService;


    /**
     * 保存文章
     * @param apArticleDto
     * @return
     */
    @Override
    @PostMapping("/api/v1/article/save")
    public ResponseResult saveArticle(@RequestBody ApArticleDto apArticleDto) {

        log.info("保存文章远程调用,{}", apArticleDto);

        return apArticleService.saveArticle(apArticleDto);
    }





}
